package com.kx.yooli.kx.wechat.config.filter;

import org.simpleframework.xml.Order;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

/**
 * @author john_sqwen-childe.wen
 * @date 2024/3/28
 * @PROJECT_NAME wechat
 * @description create FilterMvcTraceid by john_sqwen
 * and FilterMvcTraceid value is
 */
@Component
public class FilterMvcTraceId {
    @Bean
    public FilterRegistrationBean<AbstractTraceIdFilter> traceIdFilterFilterRegistrationBean(){
        FilterRegistrationBean<AbstractTraceIdFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new AbstractTraceIdFilter());
        //setting filter order
        registrationBean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return registrationBean;
    }
}
